<?php

$this->extend('/Common/admin_edit');

$this->Html
	->addCrumb('', '/admin', array('icon' => 'home'))
	->addCrumb(__('Countries'), array(
		'plugin' => 'countries', 'controller' => 'countries', 'action' => 'index'))
	->addCrumb(__('Cities'),$this->here);

if ($this->request->params['action'] == 'admin_edit') {
	$this->Html->addCrumb($this->data['City']['name'], array(
		'plugin' => 'countries', 'controller' => 'cities', 'action' => 'edit',
		$this->params['pass'][0]
	));
}

if ($this->request->params['action'] == 'admin_add') {
	$this->Html->addCrumb(__('Add'), $this->here);
}

?>
<?php echo $this->Form->create('City',array('type'=>'file'));?>

<div class="row-fluid">
	<div class="span8">

		<ul class="nav nav-tabs">
			<li><a href="#city-main" data-toggle="tab"><?php echo __('City'); ?></span></a></li>
			<!--<li><a href="#city-params" data-toggle="tab"><?php //echo __('Params'); ?></a></li>-->
			<?php echo $this->Croogo->adminTabs(); ?>
		</ul>

		<div class="tab-content">
			<div id="city-main" class="tab-pane">
			<?php
				echo $this->Form->input('id');
				$this->Form->inputDefaults(array(
					'label' => false,
					'class' => 'span10',
				));
				echo $this->Form->input('name', array(
					'placeholder' => __('Name'),
				));
				echo $this->Form->input('alias', array(
					'placeholder' => __('Alias'),
                                                  'class'=>'span10 alias'
				));
				echo $this->Form->input('country_id', array(
					'placeholder' => __('Country'),
					'rel' => __('Choose a country'),
                                                  'style'=>'display:none'
				));				
				$limit_fields = json_decode(Configure::read('Countries.city_fields'));
				if(in_array('zipcode',$limit_fields)){
					echo $this->Form->input('zipcode', array(
						'placeholder' => __('Zip Code'),
					));						
				}	
			?>
			</div>
			<!--
			<div id="city-params" class="tab-pane">
			<?php
				//echo $this->Form->input('City.params', array(
					//'placeholder' => __('Params'),
				//));
			?>
			</div>			
			-->
			<?php echo $this->Croogo->adminTabs(); ?>
		</div>
	</div>

	<div class="span4">
		<?php
			echo $this->Html->beginBox(__('Publishing')) .
				$this->Form->button(__('Apply'), array('name' => 'apply', 'button' => 'default')) .
				$this->Form->button(__('Save'), array('button' => 'default')) .
				$this->Html->link(__('Cancel'), array('action' => 'index'), array('button' => 'danger')) .
				$this->Form->input('status', array(
					'label' => __('Status'),
					'class' => false,
				)).
				$this->Html->endBox();
			echo $this->Croogo->adminBoxes();
		?>
	</div>

</div>
<?php echo $this->Form->end(); ?>
<?php 		
        //echo $this->Layout->slug('CityName');
?>